// vite.config.ts
import { fileURLToPath, URL } from "node:url";
import { defineConfig, loadEnv } from "file:///E:/mywork/2024/insurance/node_modules/.pnpm/vite@5.4.11_@types+node@20.17.6_sass@1.80.7_terser@5.36.0/node_modules/vite/dist/node/index.js";
import vue from "file:///E:/mywork/2024/insurance/node_modules/.pnpm/@vitejs+plugin-vue@5.2.0_vite@5.4.11_@types+node@20.17.6_sass@1.80.7_terser@5.36.0__vue@3.5.12_typescript@5.4.5_/node_modules/@vitejs/plugin-vue/dist/index.mjs";
import vueJsx from "file:///E:/mywork/2024/insurance/node_modules/.pnpm/@vitejs+plugin-vue-jsx@4.1.0_vite@5.4.11_@types+node@20.17.6_sass@1.80.7_terser@5.36.0__vue@3.5.12_typescript@5.4.5_/node_modules/@vitejs/plugin-vue-jsx/dist/index.mjs";
import { createHtmlPlugin } from "file:///E:/mywork/2024/insurance/node_modules/.pnpm/vite-plugin-html@3.2.2_vite@5.4.11_@types+node@20.17.6_sass@1.80.7_terser@5.36.0_/node_modules/vite-plugin-html/dist/index.mjs";
import { visualizer } from "file:///E:/mywork/2024/insurance/node_modules/.pnpm/rollup-plugin-visualizer@5.12.0_rollup@4.26.0/node_modules/rollup-plugin-visualizer/dist/plugin/index.js";
import path from "path";
var __vite_injected_original_dirname = "E:\\mywork\\2024\\insurance";
var __vite_injected_original_import_meta_url = "file:///E:/mywork/2024/insurance/vite.config.ts";
var vite_config_default = defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd());
  console.log("VITE_BASE_URL:", env.VITE_BASE_URL);
  const plugins = [
    vue(),
    vueJsx(),
    createHtmlPlugin({
      minify: true,
      /**
       * 在这里写entry后，你将不需要在`index.html`内添加 script 标签，原有标签需要删除
       * @default src/main.ts
       */
      entry: mode === "mobile" ? "src/main-m.ts" : "src/main-pc.ts",
      /**
       * 如果你想将 `index.html`存放在指定文件夹，可以修改它，否则不需要配置
       * @default index.html
       */
      // template: 'public/index.html',
      /**
       * 需要注入 index.html ejs 模版的数据
       */
      inject: {
        data: {},
        tags: []
      }
    })
  ];
  if (process.env.NODE_ENV === "production") {
    const filename = path.resolve(
      __vite_injected_original_dirname,
      `dist/${mode === "mobile" ? "mobile" : "pc"}/report.html`
    );
    plugins.push(
      visualizer({
        open: true,
        // 打包后自动打开报告
        filename,
        // 生成的报告文件名和路径
        template: "treemap"
        // 可选：报告的模板类型
      })
    );
  }
  return {
    base: env.VITE_BASE_URL,
    // 设置打包后的输入前缀
    plugins,
    resolve: {
      alias: {
        "@": fileURLToPath(new URL("./src", __vite_injected_original_import_meta_url)),
        "@ny-ui": path.resolve(__vite_injected_original_dirname, "./packages/src")
        // 设置别名
      }
    },
    build: {
      // 根据不同的目标设置输出目录
      outDir: mode === "mobile" ? "dist/mobile" : "dist/pc",
      rollupOptions: {
        input: path.resolve(__vite_injected_original_dirname, "index.html")
      }
    },
    server: {
      proxy: {
        // 代理 /api_cps 路径
        "/api_cps": {
          target: "http://cps.run4wd.com/api/",
          // 目标服务器
          changeOrigin: true,
          // 是否改变源
          rewrite: (path2) => path2.replace(/^\/api_cps/, "/")
          // 重写路径
        },
        "/api_op": {
          target: "http://47.99.75.3:8050/",
          changeOrigin: true,
          rewrite: (path2) => path2.replace(/^\/api_op/, "/")
          // 重写路径
        }
      }
    }
  };
});
export {
  vite_config_default as default
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCJFOlxcXFxteXdvcmtcXFxcMjAyNFxcXFxpbnN1cmFuY2VcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZmlsZW5hbWUgPSBcIkU6XFxcXG15d29ya1xcXFwyMDI0XFxcXGluc3VyYW5jZVxcXFx2aXRlLmNvbmZpZy50c1wiO2NvbnN0IF9fdml0ZV9pbmplY3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